﻿using BaseDll;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StationDemo
{
    public partial class FormInfoBeforeStart : UIForm
    {
        public FormInfoBeforeStart()
        {
            InitializeComponent();
        }

      public   bool bSure = false;
        private void btnSure_Click(object sender, EventArgs e)
        {
            bSure = true;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            
            bSure = false;
            this.Close();
        }
        Dictionary<string, Dictionary<string, ParamSet>> Items = null;
        public void AddToDataGrid(Dictionary<string, Dictionary<string, ParamSet>>  items)
        {
            Items = items;
        }
        public FormInfoBeforeStart(Dictionary<string, Dictionary<string, ParamSet>> items)
        {
            Items = items;
            InitializeComponent();
        }

        private void FormInfoBeforeStart_Load(object sender, EventArgs e)
        {
            string strParamVal = $"";
            uiDataGridView1.Width = tableLayoutPanel1.Width;
            uiDataGridView1.Columns[0].Width = (int)(uiDataGridView1.Width * 0.2);
            uiDataGridView1.Columns[1].Width = (int)(uiDataGridView1.Width * 0.5);
            uiDataGridView1.Columns[2].Width = (int)(uiDataGridView1.Width * 0.3);
            btnSure.Width = (int)(uiDataGridView1.Width * 0.5)-2;
            btnCancel.Location = new Point(btnSure.Location.X + btnSure.Width, btnSure.Location.Y);
            btnCancel.Width = (int)(uiDataGridView1.Width * 0.5)-2;
            foreach (var TEM in Items)
            {
                string str_StationName = TEM.Key;
                foreach (var item in TEM.Value)
                {
                    strParamVal = $"{item.Value._strParamVal}";
                    uiDataGridView1.ForeColor = Color.Black;
                    uiDataGridView1.AddRow(str_StationName,item.Key, strParamVal);
                }

            }
        }
    }
}
